﻿@model Weapsy.Reporting.Pages.PageAdminModel

@{
    ViewBag.Title = "Edit Page";
}

@section scripts {
    @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
    <script src="~/js/admin/pages/shared.js"></script>
    <script src="~/js/admin/pages/edit.js"></script>   
}

<div class="page-header">
    <h1>Edit Page</h1>
</div>

<form id="editPageForm" name="editPageForm" data-ajax="true" data-ajax-method="PUT" data-ajax-url="/Admin/Page/Update" data-ajax-begin="weapsy.admin.editPage.loading" data-ajax-success="weapsy.admin.pages.redirectToIndex" class="form-horizontal validate-form" role="form">
    <input type="hidden" id="id" name="id" value="@Model.Id" />

    @await Html.PartialAsync("_Page")

    <div class="form-group">
        <div class="col-md-12">
            <button id="save" type="submit" class="btn btn-primary" title="Save">Save</button>
            @if (Model.Status == Weapsy.Domain.Pages.PageStatus.Hidden)
            {
                <a id="activatePage" class="btn btn-primary" title="Activate">Activate</a>
            }
            else if (Model.Status == Weapsy.Domain.Pages.PageStatus.Active)
            {
                <a id="hidePage" class="btn btn-primary" title="Hide">Hide</a>
            }
            <a id="deletePage" class="btn btn-danger" data-toggle="modal" data-target="#confirm-delete" title="Delete">Delete</a>
            <a href="@Url.Action("Index", "Page", new { area = "Admin" })" class="btn btn-default" title="Cancel">Cancel</a>
        </div>
    </div>
</form>

@await Html.PartialAsync("_ConfirmDelete")

@*<table class="table" style="display:none;">
    <thead>
    <tr>
        <th>Sequence</th>
        <th>Type</th>
        <th>Body</th>
        <th>TimeStamp</th>
    </tr>
    </thead>
    <tbody data-bind="foreach: events">
    <tr>
        <td data-bind="text: sequence"></td>
        <td data-bind="text: type"></td>
        <td data-bind="text: body"></td>
        <td data-bind="text: timeStamp"></td>
    </tr>
    </tbody>
</table>*@

@*<div class="alert alert-success alert-dismissible" role="alert" data-bind="visible: pageSaved">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    New page saved.
</div>*@